import { DatePicker, message, Form, Button } from 'antd';
import { PageContainer } from '@ant-design/pro-components';
import { redeemActivateCode } from '@/services/batchManage';

const PrimeData: React.FC = () => {
  const [modalCodeForm] = Form.useForm();

  const handleCodeOK = async () => {
    modalCodeForm.validateFields().then(async (values) => {
      console.log('批量激活--values', values);
      const { code, data } = await redeemActivateCode({ ...values });
      if (code === 200 && data) {
        message.success('批量激活完成,详细信息请看日志');
        // modalCodeForm.resetFields();
      } else {
        message.error('批量激活失败');
      }
    });
  };

  return (
    <PageContainer>
      <div
        style={{
          width: '100%',
          height: '100%',
          display: 'flex',
          background: 'white',
          alignItems: 'center',
        }}
      >
        <Form
          style={{ marginTop: 24 }}
          labelCol={{ span: 6 }}
          form={modalCodeForm}
          initialValues={{
            id: '',
            num: '',
          }}
        >
          <Form.Item label="时间范围" name="id">
            <DatePicker.RangePicker showTime />
          </Form.Item>
        </Form>
        <Button type="primary" key="add" style={{ marginLeft: 100 }}>
          恢复
        </Button>
      </div>
    </PageContainer>
  );
};

export default PrimeData;
